The present invention relates to reducing memory requirements or overhead in a computing environment. More specifically, the invention relates to reducing the size of object headers, thereby reducing the amount of memory required to store the objects of a program.
Object-oriented programming involves defining objects or, more broadly, abstractions of items that need to be manipulated or processed in order to solve the problem or meet the objective addressed by the program. Objects are a type of data structure that include defined information or attributes. Objects can also be manipulated in a manner similar to variables (such as integer, Boolean, and floating point variables) in procedural programming languages. However, the types of operations (functions or methods) that may be performed on an object are defined by the programmer. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.
An object is an instance of a class. A class is a specification or template that defines the characteristics (attributes and methods) for all objects of that class type. One of the principal advantages of object-oriented programming techniques over procedural programming techniques is that they enable programmers to create modules that do not need to be changed when a new type of object is added. A programmer can simply create a new object that inherits many of its features from existing objects. This makes object-oriented programs easier to modify.
There are several object-oriented programming languages including C++ and Java. Before it is executed, Java source code is usually translated or compiled into byte code by a Java compiler. The byte code is then interpreted or converted to machine language at run time. Java can be implemented as an interpreted language, meaning programs written in Java can be run using an interpreter. An interpreter decodes and runs a program at the same time. Specifically, the interpreter decodes one line of programming, executes that line of code, and then proceeds to the next line of code.
The Java Virtual Machine (“VM”) carries out the task of interpreting or otherwise executing the Java byte code. Java VMs are present in most browsers and widely licensed for use in a variety of computing devices. With most other programming languages, different versions of a program must be developed for different computer environments. Further, Java programs can be stored in relatively small files, which is important in applications where memory is limited (e.g., when running software on cell phones, personal digital assistants, and the like) and makes transmitting the programs over networks easier and faster.
While it is possible to create a computing environment specifically designed for Java (e.g., by using a Java chip), most Java platforms are deployed on top of a non-Java host environment that employs a standard processor with a Java VM installed in memory. A Java platform is a programming environment that includes the Java VM and the Java application programming interface (“API”). The Java API consists of a set of predefined classes.
Most Java VMs use two 32-bit words at the front of each object as a “header.” The header is used to provide the VM and the garbage collector (a routine that reclaims memory occupied by program segments that are no longer active) certain information about every object in the program being executed. This information includes the object's class, size, and dispatch table (used to call virtual methods). The header also provides information regarding the object's references, the bits (indicating color) used by the garbage collector, hash code information, and monitor information (thread synchronization activity).